package com.hnhegui.backend.platform.service.system;

import com.hnhegui.backend.entity.PageResult;
import com.hnhegui.backend.entity.Result;
import com.hnhegui.backend.platform.convert.system.UserConvert;
import com.hnhegui.backend.platform.vo.system.request.UserQueryRequestVO;
import com.hnhegui.backend.platform.vo.system.response.UserResponseVO;
import com.hnhegui.backend.system.api.UserRestApi;
import com.hnhegui.backend.system.dto.response.UserResponseDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 刘大海
 * @since 2025/10/27 11:41
 */
@Service
public class RestUserService {

    @Autowired
    UserRestApi userRestApi;

    public PageResult<UserResponseVO> queryUsers(UserQueryRequestVO request) {
        Result<PageResult<UserResponseDTO>> pageResultResult =
            userRestApi.queryUsers(UserConvert.INSTANCE.convertRequest(request));
        return UserConvert.INSTANCE.convertResponse(pageResultResult.getData());
    }
}
